
#include <stdio.h>
#include <string.h>
int main()
{ 
	char start[201];
	scanf("%s",start);
	char operate[201];
	int len=strlen(start);
	while(1)
	{
		scanf("%s",operate);
		if(operate[0]=='c'&&operate[1]=='d'&&operate[2]==' ')
		{
			if(operate[3]=='/')
			strcpy(start,operate+3);
			else if(operate[3]=='.'&&operate[4]=='.')
			{
				for(int i=len-1;i>=0;i--)
				{
					
					if(start[i]=='/')
					{
						if(i==0)
						{
							start[1]=='\0';
						}
						else
						{
							start[i]=='\0';
						}
						break;
					}
				}
			}
			else
			{
				start[len]='/';
				strcpy(start,operate+3);
			}
		}
		else if(operate[0]=='p'&&operate[1]=='w'&&operate[2]=='d')
		printf("%s\n",start);
		break;
	}
	return 0;
}
